package com.assignwork.modules.pc;

import com.assignwork.dto.pcplan.PcShipPlanSearchDto;
import com.assignwork.dto.pcplan.PcShipPlanSubmitDto;
import com.assignwork.modules.pc.service.pc.IPcShipPlanService;
import com.assignwork.vo.pc.PcShipPlanVo;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("pcShipPlan")
@AllArgsConstructor
@Api(value = "排船计划", tags = "排船计划")
public class PcShipPlanController extends BladeController {
    private IPcShipPlanService service;

    @PostMapping("/submit")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "新增或修改", notes = "传入entity")
    public R<Boolean> submitPcShipPlan(@Valid @RequestBody PcShipPlanSubmitDto submitDTO) {
        return R.status(service.submitPcShipPlan(submitDTO));
    }

    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "列表", notes = "传入dto")
    public R<List<PcShipPlanVo>> selectPcShipPlanList(PcShipPlanSearchDto dto) {
        List<PcShipPlanVo> data = service.selectPcShipEfficiencyList(dto);
        return R.data(data);
    }

}
